home *** CD-ROM | disk | FTP | other *** search
- /* general.h -- defines that everybody likes to use. */
-
- #if !defined (_GENERAL_)
- #define _GENERAL_
-
- #if !defined (NULL)
- #define NULL 0x0
- #endif
-
- #ifndef savestring
- #define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x))
- #endif
-
- #ifndef whitespace
- #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
- #endif
-
- #ifndef digit
- #define digit(c) ((c) >= '0' && (c) <= '9')
- #endif
-
- #ifndef isletter
- #define isletter(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
- #endif
-
- #ifndef digit_value
- #define digit_value(c) ((c) - '0')
- #endif
-
- #if !defined (__STDC__)
- char *index (), *rindex ();
- #endif
-
- #ifndef member
- #define member(c, s) (int)((c) ? index ((s), (c)) : 0)
- #endif
-
- /* String comparisons that possibly save a function call each. */
- #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
- #define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)
-
- /* Function pointers can be declared as (Function *)foo. */
- #ifndef __FUNCTION_DEF
- typedef int Function ();
- #define __FUNCTION_DEF
- #endif
-
- /* The output of `signal' is different on different systems. Yechh. */
- #if !defined (VOID_SIGHANDLER)
- # if defined (_POSIX_HANDLER) || (SunOS4) || defined (NeXT) || defined (Ultrix) || defined (USG)
- # define VOID_SIGHANDLER
- # endif
- #endif
-
- #if defined (VOID_SIGHANDLER)
- #define sighandler void
- #else
- #define sighandler int
- #endif
-
- typedef sighandler SigHandler ();
-
- #define NOW ((time_t) time ((time_t *) 0))
-
- /* Definitions to set file descriptors to close-on-exec, the Posix way. */
- #if !defined (FD_CLOEXEC)
- #define FD_CLOEXEC 1
- #endif
-
- #define FD_NCLOEXEC 0
-
- #define SET_CLOSE_ON_EXEC(fd) (fcntl ((fd), F_SETFD, FD_CLOEXEC))
- #define SET_OPEN_ON_EXEC(fd) (fcntl ((fd), F_SETFD, FD_NCLOEXEC))
-
- extern char *itos ();
-
- #endif /* _GENERAL_ */
-
-
-
-